/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MessagesPanel.java
 *
 * Created on 11/03/2009, 20:07:10
 */
package br.unisc.pdaapp.ui.messages;

import br.unisc.pdaapp.meta.IForm;
import br.unisc.pdaapp.constants.IPanels;
import br.unisc.pdaapp.ui.*;

/**
 *
 * @author guilherme
 */
public class MessagesPanel extends javax.swing.JPanel implements IForm
{
    private static MessagesPanel instance;

    /** Creates new form MessagesPanel */
    private MessagesPanel()
    {
        initComponents();
    }
    
    public static MessagesPanel getInstance()
    {
        if (instance == null)
        {
            instance = new MessagesPanel();
        }

        return instance;
    }

    public void setHeader(String text)
    {
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        jPanel3 = new javax.swing.JPanel();
        backButton1 = new javax.swing.JButton();
        exitButton = new javax.swing.JButton();
        centerPanel = new javax.swing.JPanel();
        sendMessagesButton = new javax.swing.JButton();
        readMessagesButton = new javax.swing.JButton();

        setBackground(new java.awt.Color(255, 255, 255));
        setLayout(new java.awt.BorderLayout());

        jPanel3.setOpaque(false);
        jPanel3.setLayout(new java.awt.GridBagLayout());

        backButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/unisc/pdaapp/ui/images/back.jpeg"))); // NOI18N
        backButton1.setBorder(null);
        backButton1.setOpaque(false);
        backButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                backButton1ActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 1);
        jPanel3.add(backButton1, gridBagConstraints);

        exitButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/unisc/pdaapp/ui/images/close.jpeg"))); // NOI18N
        exitButton.setBorder(null);
        exitButton.setOpaque(false);
        exitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitButtonActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel3.add(exitButton, gridBagConstraints);

        add(jPanel3, java.awt.BorderLayout.NORTH);

        centerPanel.setBackground(new java.awt.Color(255, 255, 255));
        centerPanel.setLayout(new java.awt.GridBagLayout());

        sendMessagesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/unisc/pdaapp/ui/images/writemail.jpeg"))); // NOI18N
        sendMessagesButton.setText("Enviar Mensagens");
        sendMessagesButton.setContentAreaFilled(false);
        sendMessagesButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sendMessagesButtonActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(8, 5, 8, 5);
        centerPanel.add(sendMessagesButton, gridBagConstraints);

        readMessagesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/unisc/pdaapp/ui/images/reademail.jpeg"))); // NOI18N
        readMessagesButton.setText("Ver Mensagens");
        readMessagesButton.setContentAreaFilled(false);
        readMessagesButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                readMessagesButtonActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(8, 5, 8, 5);
        centerPanel.add(readMessagesButton, gridBagConstraints);

        add(centerPanel, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    private void sendMessagesButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_sendMessagesButtonActionPerformed
    {//GEN-HEADEREND:event_sendMessagesButtonActionPerformed
        MoodleMobileFrame.getInstance().switchPanel(IPanels.MESSAGES_SENDER_PANE);
    }//GEN-LAST:event_sendMessagesButtonActionPerformed

    private void readMessagesButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_readMessagesButtonActionPerformed
    {//GEN-HEADEREND:event_readMessagesButtonActionPerformed
        MoodleMobileFrame.getInstance().switchPanel(IPanels.MESSAGES_READER_PANE);
    }//GEN-LAST:event_readMessagesButtonActionPerformed

    private void backButton1ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_backButton1ActionPerformed
    {//GEN-HEADEREND:event_backButton1ActionPerformed
        MoodleMobileFrame.getInstance().switchPanel(IPanels.CLASSES_PANE);
}//GEN-LAST:event_backButton1ActionPerformed

    private void exitButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_exitButtonActionPerformed
    {//GEN-HEADEREND:event_exitButtonActionPerformed
        MoodleMobileFrame.getInstance().quit(this);
}//GEN-LAST:event_exitButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton backButton1;
    private javax.swing.JPanel centerPanel;
    private javax.swing.JButton exitButton;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JButton readMessagesButton;
    private javax.swing.JButton sendMessagesButton;
    // End of variables declaration//GEN-END:variables

}
